//------------------------------------------------------------------------
//- - - - - - - - - - - - -
//      OVERVIEW
//- - - - - - - - - - - - -
//Each of these files describes the sound of an instrument.
//More specifically, they control various parameters of Bawami in order to
//control the sound.
//This particular file, default.txt, is what Bawami will use for any
//instrument for which a numbered TXT file does not exist.
//Lines that begin with 2 slashes, such as this line, are ignored.
//The basic stages to form the sound are:
//
//Oscillator -> bitcrush (noise only) -> volume envelope -> volume boost 
//-> low-pass filter -> high-pass filter (not yet implemented)
//-> distortion


//- - - - - - - - - - - - - - - -
//      VOLUME ENVELOPE
//- - - - - - - - - - - - - - - -
//This controls the volume level over time. A volume of 0 is silent;
//1 represents "full" volume.
//     /\
//    /  \
//   /    \_______
//  /             \
//  [A ][D][  S  ][R]
//
//The height of the line in this diagram represents volume, higher being
//louder, and its horizontal position represents time, from left to right.
//
//A = Attack (increasing). When a note is pressed, the
//    volume starts to rise until it reaches 1.
//D = Decay (decreasing). While the note is still
//    being held, the volume begins to drop again.
//S = Sustain (steady). This is the level which the
//    volume falls to and stays steady at, while the
//    note is being held.
//R = Release (decreasing). When the note stops being
//    pressed, the volume falls until it reaches 0.
//
//Note that the attack, decay and release are effectively optional 
//(they can be skipped by being made as fast as possible).

//- - - - - - - AttackSpeed: Higher than 0
//Speed at which envelope rises from the starting value to 1.
//Lower values cause more gradual (slow) attacks.
//If AttackIsLin is 1, 1 = instant (no attack time).
//If AttackIsLin is 0, this must be higher than 1.
AttackSpeed 1

//- - - - - - - AttackStart: Minimum of 0, maximum of 1
//Starting value of the envelope.
//If AttackIsLin is 0, this must be higher than 0.
//Set to 1 to make sure that there is not a millisecond of silence at the
//start of the note if using no attack.
AttackStart 1

//- - - - - - - AttackIsLin: 0 or 1
//If 1, will linearly add AttackSpeed to the envelope every millisecond.
//If 0, will multiply envelope by AttackSpeed every millisecond.
AttackIsLin 1

//- - - - - - - DecaySpeed: Minimum of 0, maximum of 1
//Speed at which envelope falls from AttackStart.
//If DecayStyle is 1, 1 = instant (no decay time), and
//                    must be higher than 0.
//If DecayStyle is 0, this must be lower than 1.
//If DecayStyle is 2, this must be higher than 0.
DecaySpeed 0.9975

//- - - - - - - DecayStyle: 0 or 1 or 2
//Specifies exactly what DecaySpeed represents.
//0: Logarithmically aim for 0, using 
//   DecaySpeed as a multiplier every millisecond.
//   Lower DecaySpeed values are much faster (0 = instant).
//1: Subtract DecaySpeed from envelope (linear) every
//   millisecond. Higher DecaySpeed values are faster.
//2: Logarithmically aim for SustainLevel, using
//   DecaySpeed as a multiplier every millisecond.
//   Higher values are much faster (1 = instant).
DecayStyle 0

//- - - - - - - SustainLevel: Minimum of 0, maximum of 1
//Minimum value of the envelope after the attack, before releasing note.
SustainLevel 0.9
//- - - - - - - ReleaseSpeed: Minimum of 0, maximum of 1
//Speed at which the envelope falls from its current value to 0, when the
//note is released.
//If ReleaseIsLin is 0, lower values are much faster (0 = instant).
			Must be lower than 1.
//If ReleaseIsLin is 1, higher numbers are faster (1 = instant).
			Must be higher than 0.
ReleaseSpeed 0.975

//- - - - - - - ReleaseIsLin: 0 or 1
//1: will linearly subtract ReleaseSpeed from the envelope every
//   millisecond.
//0: will multiply envelope by ReleaseSpeed every millisecond.
ReleaseIsLin 0


//- - - - - - - - - - - - - -
//      OSCILLATOR
//- - - - - - - - - - - - - -
//The oscillator is what creates the sound's first basic waveform, before
//it has been filtered or "shaped" with any envelopes.

//- - - - - - - OscWave: 0 or 1 or 2 or 3 or 5
//The base waveform.
//0: Sine          (smooth waves)
//1: Square        (sudden up,    sudden down)
//2: Triangle up   (gradual up,   sudden down)
//3: Triangle down (gradual down, sudden up)
//5: Noise         (random positions)
//4 is sawtooth (gradual up, gradual down), but the frequency is not set 
//accurately while using this waveform, so it's recommended not to use it.
OscWave 1


//- - - - - - - - - - - - - - - -
//      LOW-PASS FILTER
//- - - - - - - - - - - - - - - -
//This filter is typically used to reduce the "harshness" of the square,
//triangle or noise waveforms by muffling them, allowing only lower
//frequencies to pass. By increasing the resonance, it can also be used to
//emphasize a certain frequency. Frequencies above the cutoff frequency
//will be quietened. The cutoff frequency can be either constant, related
//to the note's frequency, related to the volume envelope, related to the 
//note's velocity, or a combination of these.
//
//The cutoff frequency is calculated in 2 stages. The first stage involves
//LPFreqMax, and optionally LPEnvLink, LPFreqMin and LPVelRatio. Details
//are below, but here are some examples to show you some possibilities:
//Cutoff is always 5000 Hz:
//	LPFreqMax 5000
//Cutoff falls from 5000 to 2000 Hz as the note fades:
//	LPFreqMax 5000, LPFreqMin 2000, LPEnvLink 1
//Cutoff is 5000 Hz if key is played hard (full velocity),
//or 2500 Hz (half) if note is played gently (half velocity):
//	LPFreqMax 5000, LPVelRatio 1
//Cutoff falls from 5000 to 2000 Hz if note is full-velocity,
//or falls from 4700 to 2000 Hz (10% smaller range) if half-velocity:
//	LPFreqMax 5000, LPFrqeMin 2000, LPEnvLink 1, LPVelRatio 0.2
//	(Range is 10% smaller instead of 20% smaller because the velocity
//      is still half. As velocity approaches 0, range approaches 20%
//	smaller).
//
//After this, a multiple of the note's current frequency can be added (i.e.
//key-tracking). Full detail is below.

//- - - - - - - LPUsing: 0 or 1
//Whether or not the low-pass filter is enabled for this instrument.
//If it's not necessary, it should not be enabled, to save CPU time.
//0: Disabled (further low-pass filter settings won't have any effect).
//1: Enabled.
LPUsing 0

//- - - - - - - LPEnvLink: 0 or 1
//The cutoff frequency of the low-pass filter can be linked to the
//volume envelope, so that the frequency changes over time as the
//volume does.
//0: The cutoff frequency stays constant (at LPFreqMax).
//1: The cutoff frequency rises and falls along with the volume.
//   When the volume envelope is at 0, the cutoff frequency is LPFreqMin.
//   When the volume envelope is at 1, the cutoff frequency is LPFreqMax.
LPEnvLink 0

//- - - - - - - LPFreqMax: Minimum of 0, maximum of 22050
//A specific cutoff frequency, in Hz. 
//If LPEnvLink is 1...
//   ...and LPVelRatio is 0, this value is the cutoff frequency when the
//                           volume envelope is at 1.
//   ...and LPVelRatio is above 0, see LPVelRatio below for details.
//If LPEnvLink is 0...
//   ...and LPVelRatio is 0, the cutoff frequency will be this all the
//                           time.
//   ...and LPVelRatio is above 0, the cutoff frequency will be this if
//                           the note's velocity is maximum. As the
//                           velocity drops, so does the cutoff
//                           frequency.
LPFreqMax 2000

//- - - - - - - LPFreqMin: Minimum of 0, maximum of 22050
//If LPEnvLink is 1, this is the cutoff frequency (in Hz) when the volume
//                   envelope is at 0.
//If LPEnvLink is 0, this is not used.
//NOTE: Although this is named "Min", it does not have to be lower than
//      LPFreqMax. If it is higher, the frequency will instead curve
//      downwards during the attack and upwards during the release.
LPFreqMin 50

//- - - - - - - LPVelRatio: Minimum of 0, maximum of 1
//Finally, the cutoff frequency as calculated so far can be scaled (from
//0 Hz) according to the current note's velocity (how hard the key was
//pressed). This allows e.g. a piano to sound not only quieter, but also
//softer (less harsh) when played more gently. This value specifies how
//strongly the note's velocity is allowed to modify the filter's cutoff
//frequency. Examples:
//0:   Velocity only controls volume; filter remains unchanged.
//0.1: Even if velocity is very low, cutoff frequency only drops by a
//     tiny amount (10% if velocity is 0).
//1:   Cutoff frequency approaches 0 Hz as velocity approaches 0
//     (it is recommended not to use high resonance in this case).
LPVelRatio 0

//- - - - - - - LPVelCurve: Minimum of 0, maximum of 16
//This allows an exponential curve to be applied to the velocity before
//it is used above (before LPVelRatio modifies the cutoff frequency
//according to the velocity). Basically, if LPVelRatio is 1 (the highest
//allowed) and it still doesn't have a strong enough effect, increase this
//value. This will give bias towards the low end, causing even notes which
//are only slightly below full-velocity to have their cutoff frequency
//moved a lot closer to the LPFreqMin side than if this value was 0.
//Examples:
// 0: Velocity is treated linearly when it is used to modify the
//    cutoff frequency (no bias towards the low end).
// 2: Velocity is slightly biased to the low end when modifying cutoff
//    frequency (velocity of 80% is treated as if it is 62%).
// 6: Strong bias towards the low end
//    (velocity of 80% is treated as if it is 30%)
//16: Bias so strong that high cutoff frequencies will rarely be heard
//    (velocity of 80% is treated as if it is 4%).
LPVelCurve 0

//- - - - - - - LPFreqNote: Minimum of -32, maximum of 32
//The cutoff frequency as calculated above (by LPFreqMax, etc) can now
//optionally have the current note's frequency (or a multiple of it) added
//to it. This is what some synthesizers call "key-tracking".
//This value specifies how much of the note's frequency to add to the
//cutoff frequency as calculated so far. Some useful multiples include:
// 1   = the note's actual frequency    (+ 0 semitones) is added.
// 2   = the note one octave higher     (+12 semitones) is added.
// 3   = a fifth note one octave higher (+18 semitones) is added.
// 0.5 = the note one octave lower      (-12 semitones) is added.
// 0   = nothing is added               (key-tracking is disabled).
//-1   = note frequency is subtracted   (key-tracking is inverted).
//
//IMPORTANT:
//If using a negative number, higher notes will result in a lower cutoff
//frequency. Ensure that LPFreqMax is set to a high value so that the
//finally-calculated cutoff frequency doesn't become negative, to avoid
//sound glitches such as pops. To avoid nasty surprises (loud pops), 
//please test by playing MIDIs with very low and very high-pitched notes
//at a not-too-loud volume.
LPFreqNote 0

//- - - - - - - LPResonance: Minimum of 0.5, maximum of 8
//If this is higher than 0.5, sound around the cutoff frequency will be
//boosted in volume. Higher values also cause the filter to become more
//"strict", with only frequencies very close to the cutoff frequency
//remaining when LPResonance is around 5. Example:
//   _________
//           :\_
//           :  \_         LPResonance = 0.5
//           :    \_
//           :      \_
//  1K      2K      4K
//
//         
//   _______/\
//           :\
//           : \           LPResonance = 2
//           :  \
//           :   \
//  1K      2K      4K
//
//The line in the diagrams represents the volume of a given frequency.
//The height represents the volume. This is not an accurate diagram; it's
//just to give the basic idea. The dotted line is the cutoff frequency.
LPResonance 0.5


//- - - - - - - - - - - - - - - -
//      HIGH-PASS FILTER
//- - - - - - - - - - - - - - - -
//This filter makes the sound less "full" or more "tinny", by allowing only
//higher frequencies to pass. High-pass and low-pass filters can be used
//at the same time, to only keep a certain range of frequencies.
//NOTE: Not yet implemented! These settings will currently have no effect.

//- - - - - - - HPUsing: 0 or 1
//Whether or not the high-pass filter is enabled for this
//instrument. Disable it to save CPU time.
//0: Disabled.
//1: Enabled.
HPUsing 0

//- - - - - - - HPResonance: Minimum of 0.5
//As with the low-pass filter, if HPResonance is higher than 0, sound
//around the cutoff frequency will be boosted in volume, and fewer low
//frequencies will be allowed to pass. Example:
//           _________
//         _/:
//       _/  :             HPResonance = 0.5
//     _/    :
//   _/      :
//  1K      2K      4K
//
//         
//           /\_________
//          /:
//         / :             HPResonance = 2
//        /  :
//       /   :
//  1K      2K      4K
//
//The diagram is just to illustrate the effect of resonance,
//and isn't accurate.
HPResonance 0.5

//- - - - - - - HPFrequencyMax: Higher than 0
//The cutoff frequency, in Hz. Frequencies below this will be quietened.
HPFreqMax 1000


//- - - - - - - - - - - - - - - -
//      VOLUME BOOST
//- - - - - - - - - - - - - - - -
//Using the filters above will often unintentionally quieten the final
//sound, making the instrument inaudible over other instruments.
//Therefore, the volume can be boosted to bring the final sound up to a
//volume which matches that of the other instruments. If necessary, the
//volume can be reduced instead (for example, if resonance makes the
//instrument too loud).

//- - - - - - - VolBoost: Higher than 0
//The volume is multiplied by this value.
//1   is the default, and makes no change to the volume.
//0.5 halves the volume.
//2   doubles the volume.
//Values above 8 start to clip (distort) the waveform,
//so they should be avoided.
VolBoost 1


//- - - - - - - - - - - - - - - -
//      DISTORTION
//- - - - - - - - - - - - - - - -
//It is possible to distort the signal as it has been made so far. This
//can be used to, for example, make resonance on the low-pass filter sound
//harsher. Actually, the distortion is applied to the collective sound of
//all notes playing on this instrument's MIDI channel, meaning that
//instruments such as Distortion Guitar can have a realistic distortion
//that allows power chords (fifths) to sound much better than simply 2
//square waves playing together.

//- - - - - - - DistLevel: Minimum of 0, maximum of 1
//Strength of the distortion effect. Low values make little difference.
//0   is the default, and applies no distortion.
//0.9 applies enough distortion for an "overdriven guitar" sound. 
//1   applies so much distortion that the signal becomes almost 1-bit.
DistLevel 0

//- - - - - - - DistAfterVol: Higher than 0
//Similar to VolBoost; this allows you to quieten the sound, compensating
//for the increased volume caused by the distortion effect (or, if
//necessary, boost the volume). However, unlike VolBoost, this is applied
//AFTER distortion, and as a result, does not "weaken" the effect. This 
//is ignored (treated as 1) if distortion is not used (DistLevel is 0).
//1   is the default, and makes no change to the volume.
//0.5 halves the volume.
//2   doubles the volume.
DistAfterVol 1


//- - - - - - - - - - - - - - - -
//      DOWNSAMPLING (BITCRUSH)
//- - - - - - - - - - - - - - - -
//Normally, instruments that are noise-based (use "OscWave 5") sound the 
//same no matter whether a high-pitched or low-pitched note is playing. 
//A low-pass filter whose cutoff frequency is tied to the note frequency 
//(e.g. "LPFreqNote 1") can help, but sometimes, you don't want the exact 
//frequency to be so obvious. In this case, you can use downsampling to 
//create a lo-fi, "bitcrushed" effect (as is used for retro snare drums).

//- - - - - - - NoiseBaseFreq: 0 or higher than 50
//If 0, nothing will be changed (depth of "bitcrush" effect on the noise 
//will only be changed by pitch-bends, as was the case before revision 98
//of Bawami).
//Otherwise, the number is a frequency in Hz. When a note plays at this 
//frequency, noise will play at the full sample-rate (44100 Hz). If a note 
//of half this frequency plays, the sample rate will be halved, and this 
//downsampling produces the characteristic "bitcrush" effect. Therefore 
//higher numbers result in a stronger bitcrush effect, as note frequencies 
//will be much lower than the given number. As a test, try 3800.
NoiseBaseFreq 0


//- - - - - - - - - - - - - - - -
//      MODULATION DESTINATION
//- - - - - - - - - - - - - - - -
//By default, modulation in MIDI files controls vibrato (a cyclic offset 
//of the note's frequency). However, you can choose to have modulation 
//control tremolo (a cyclic offset of the note's volume), either instead 
//of, or as well as, vibrato. The exact relationship between modulation, 
//vibrato and tremolo are given as multiples (ModToFreq and ModToVol, 
//respectively). Vibrato and tremolo are in-sync. If ModToFreq is positive, 
//the frequency offset of the vibrato will be at its highest point when the 
//volume is at its loudest. If necessary, ModToFreq can be negative to 
//invert the phase of the vibrato (frequency will be at its lowest point 
//when volume is at its loudest).

//- - - - - - - ModToFreq: Minimum of 0.2, maximum of 2 (recommended)
//Modulation controls frequency by this much (a multiple). It is 
//recommended to keep this above 0. This is because a MIDI message to set 
//modulation depth will have no effect if this is 0 (0 multiplied by 
//anything is 0), and the message has no effect on tremolo. So, it would 
//appear that the message is ignored when this instrument is used.
// 2   = Modulation has an exaggerated effect on vibrato.
// 1   = Default. Modulation controls vibrato at the standard strength.
// 0.5 = Modulation controls vibrato half as strongly as normal.
// 0.2 = Modulation hardly affects the frequency at all.
//-1   = Modulation controls a phase-inverted, standard-strength vibrato.
ModToFreq 1

//- - - - - - - ModToVol: Minimum of 0, maximum of 1
//Modulation controls volume by this much (a multiple). The number 
//specifies the maximum amount of volume to be subtracted from and added to 
//the note's volume when modulation is at its maximum (where 0 is nothing 
//and 1 is 100% of the note's volume).
//0    = Default. Modulation doesn't affect the volume at all.
//0.25 = Full modulation will cycle the volume between 125% and 75%.
//0.5  = Full modulation will cycle the volume between 150% and 50%.
//1    = Extreme tremolo (volume cycles between 200% and 0%).
ModToVol 0

//- - - - - - - - - - - - - - - -
//      AUTOMATIC MODULATION
//- - - - - - - - - - - - - - - -
//Although MIDI files can contain messages to add modulation to a MIDI 
//channel, specific instruments can demand that modulation is automatically 
//added at a certain strength (depth) after a note has been playing for a 
//certain amount of time (delay). Very subtle modulation is recommended, 
//just enough to avoid a perfectly constant pitch sounding unpleasant. This 
//can allow e.g. an Oboe to sound as if it is being played naturally. If a 
//MIDI file wants obvious modulation, it will request it, either with the 
//modulation controller or by using NRPNs to modify these auto modulation 
//parameters.

//- - - - - - - ModAutoDepth: Minimum of 0, maximum of 1
//0-1 range is precisely the equivalent of modulation CC values of 0-127. 
//The value is a multiplier of the "default" modulation depth specified on 
//the "CC" tab of the configuration window (2 semitones by default). Values 
//below 0.15 are recommended for subtle vibrato. A few exceptions exist, 
//such as Tremolo Strings and Goblins Effect, which rely on auto modulation 
//for their unique sound. By default, no modulation is added automatically.
ModAutoDepth 0

//- - - - - - - ModAutoDelay: Minimum of 0
//The delay before auto modulation starts to be added, in seconds. After 
//this many seconds, modulation will start to be added, fading in. After 
//another "this many" seconds, the fade will be complete and modulation 
//at the full ModAutoDepth will be being added. So this value is the start 
//of the fade, and this value x2 is the end of the fade. A non-zero value 
//is used by default even though ModAutoDepth is 0; this is so that, if a 
//MIDI file changes ModAutoDepth via "Vibrato depth" NRPN, modulation won't 
//start unnaturally early.
ModAutoDelay 0.31
//ModAutoDelay 0.35

//--------------------------------------------------------------------------